<?php
namespace Tbf\Bundle\ImageBundle\Service;
use Tbf\Bundle\ImageBundle\WaterMarkTransformer;

/**
 * 下面的位置和宽度,高度均是以需要打水印的图片的尺寸的比例
 * return array(
 * 起始点的位置
 * 'buttom'=>1-0.853-0.1146, //下边的点的位置的百分比
 * 'right'=>1-0.64-0.32,     //右边的点的位置的百分比
 * 'width'=>0.32, //水印的宽度占原图的百分比
 * 'mark_file'=>__DIR__ . '/../../Resources/watermark.png' //水印图片地址
 * );
 */
class WaterMark
{
    /** @var  float */
    protected $start_point_bottom;
    /** @var  float */
    protected $start_point_right;
    /** @var  float */
    protected $water_mark_width;
    /** @var  float */
    protected $mark_file_path;

    /**
     * @param float $mark_file_path
     */
    public function setMarkFilePath($mark_file_path)
    {
        $this->mark_file_path = $mark_file_path;
    }

    /**
     * @return float
     */
    public function getMarkFilePath()
    {
        return $this->mark_file_path;
    }

    /**
     * @param float $start_point_bottom
     */
    public function setStartPointBottom($start_point_bottom)
    {
        $this->start_point_bottom = $start_point_bottom;
    }

    /**
     * @return float
     */
    public function getStartPointBottom()
    {
        return $this->start_point_bottom;
    }

    /**
     * @param float $start_point_right
     */
    public function setStartPointRight($start_point_right)
    {
        $this->start_point_right = $start_point_right;
    }

    /**
     * @return float
     */
    public function getStartPointRight()
    {
        return $this->start_point_right;
    }

    /**
     * @param float $water_mark_width
     */
    public function setWaterMarkWidth($water_mark_width)
    {
        $this->water_mark_width = $water_mark_width;
    }

    /**
     * @return float
     */
    public function getWaterMarkWidth()
    {
        return $this->water_mark_width;
    }

    public function newTransformer($quality=100)
    {
        return new WaterMarkTransformer($this,$quality);
    }
}
